package com.paperobot.common.util;

import java.io.PrintWriter;
import java.io.StringWriter;

import org.slf4j.Logger;


public class LogUtil {
	
	private Logger logger;
	
	public Logger getLogger() {
		return logger;
	}

	public void setLogger(Logger logger) {
		this.logger = logger;
	}

	public static LogUtil getInstance(Logger logger){
		LogUtil logUtil = new LogUtil();
		logUtil.setLogger(logger);
		return logUtil;
	}
	
	public void logExcepiton(Exception e){
		StringWriter trace = new StringWriter();
		e.printStackTrace(new PrintWriter(trace));
		this.logger.error(trace.getBuffer().toString());
	};
}
